package cn.xs.surveypark.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class App {
		public static void main(String[] args) throws Exception {
			
			StringBuffer buffer = new StringBuffer();
			
			char[] chars = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
			
			String src = "123";
			//算法SHA、MD5
			MessageDigest md = MessageDigest.getInstance("MD5");
			
			byte[]	data = md.digest(src.getBytes());
			for(byte b : data){
				//高4位
				buffer.append(chars[(b >> 4) & 0x0F]);
				//低4位
				buffer.append(chars[b & 0x0F]);
			}
			
			System.out.println(buffer.toString());
		}
}
